import React,{useContext} from 'react';
import {ColorConst,UpDateColor} from './color';
function Buttons(){
    const {dispatch}=useContext(ColorConst)
    return(
        <div>
            <button onClick={()=>{dispatch({type:UpDateColor,color:"red"})}}>红色</button>
            <button onClick={()=>{dispatch({type:UpDateColor,color:"green"})}}>绿色</button>
        </div>
    )
}


export default Buttons;